/*
 * Copyright 2010-2012 Susanta Tewari. <freecode4susant@users.sourceforge.net>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package genomemap.netbeans.jobs1.tab08;

import cef.command.Command;
import cef.command.ComputeModelLHoodCommand;
import cef.command.listener.ComputeModelLHoodPrintWriter;
import cef.pui.EventConstructionException;
import commons.nb.jobs.Job;
import commons.nb.jobs.properties.BuilderProperty;
import commons.nb.jobs.properties.ComboPropertyImpl;
import commons.nb.jobs.properties.Property;
import genomemap.cef.pui.ComputeOrderModelLHood_EvtImpls;
import genomemap.nb.jobs.properties.Propertys_Gen;

import java.util.List;

/**
 * @author Susanta Tewari
 */
public class ComputeLHood_TAB08_Job extends Job<ComputeOrderModelLHood_EvtImpls.TAB08> {

    public ComputeLHood_TAB08_Job() {

        setName("lhood-TAB08");
        setDisplayName("LHood TAB08");
        setShortDescription("Computes log likelihood for model TAB08");


        // data
        final BuilderProperty dataProp = Propertys_Gen.BUILDER_DATA_TAB08Data();

        addComboProperty(dataProp);


        // user order
        final Property<List<String>> orderProp = Propertys_Gen.TAB08_GeneList();

        orderProp.setCustomProperty("list", dataProp);
        addComboProperty(new ComboPropertyImpl(orderProp));


        // lhood algorithm
        addComboProperty(new ComboPropertyImpl(Propertys_Gen.ALGO_LHOOD_TAB08()));


        // attach listeners
        addCommandOutputListener(new ComputeModelLHoodPrintWriter());
    }

    @Override
    protected ComputeOrderModelLHood_EvtImpls.TAB08 createEvent()
            throws EventConstructionException {
        return new ComputeOrderModelLHood_EvtImpls.TAB08(getProperties());
    }

    @Override
    protected Command createCommand(final ComputeOrderModelLHood_EvtImpls.TAB08 event) {
        return new ComputeModelLHoodCommand<>(event);
    }

    @Override
    public boolean isCancellable() {
        return true;
    }

    @Override
    public Class<ComputeOrderModelLHood_EvtImpls.TAB08> getEventImplType() {
        return ComputeOrderModelLHood_EvtImpls.TAB08.class;
    }
}
